// -*-C++-*-
#ifndef __SOCKET_WIN_H__
# define __SOCKET_WIN_H__

# include "../ISocket.h"

# include <Winsock2.h>
#pragma comment(lib,"Ws2_32.lib")

// each Impl have same class name
//  Windows  Implementation
class SocketImpl : public ISocket
{
public:
    static unsigned int _counter;
    static WSADATA _wsa;

    SocketImpl();
    ~SocketImpl();

    SocketImpl(SocketImpl const & impl);
    SocketImpl& operator=(SocketImpl const & impl);

    virtual void open(int domain, int type);

    virtual void bind(int port, char *addr);
    virtual void listen(int backlog);
    virtual void accept(ISocket *);

    virtual void connect(int port, char *addr);

    virtual int send(const void *msg, size_t len);
    virtual int recv(void *buf, size_t len);

    virtual void close();
private:
    SOCKET _sock;
    int _domain;
    int _type;
    SOCKADDR_IN _service;
};

#endif // __SOCKET_WIN_H__
